package JavaSEAdvance.day06_Date;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @author Xiao
 * @date 2021/7/22
 */
public class D605_LocalDateTimeDemo02 {
    /**
     * 格式化和解析
     */
    public static void main(String[] args) {
        String str = "1949-10-01";
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate date = LocalDate.parse(str,formatter);
        DayOfWeek dayOfWeek = date.getDayOfWeek();
        int week = dayOfWeek.getValue();
        System.out.println("新中国成立是星期" + week);
    }
}
